package com.hejjon.controller;

import com.hejjon.bean.LibrarySettingParam;
import com.hejjon.core.bean.ResponseResult;
import com.hejjon.core.controller.BaseController;
import com.hejjon.service.ILibrarySettingService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/librarySetting")
public class LibrarySettingController extends BaseController {


    @Resource
    private ILibrarySettingService librarySettingService;

    /**
     * 获取设置项
     */
    @GetMapping("/getLibrarySettingsMap")
    public ResponseResult getLibrarySettingsMap() {
        return success(librarySettingService.getLibraryInitSettingsMap());
    }

    /**
     * 保存配置项
     */
    @PostMapping("/saveSetting")
    public ResponseResult saveSetting(@RequestBody LibrarySettingParam param) {
        return toResult(librarySettingService.saveSetting(param));
    }

    @GetMapping("/getByNodeId")
    public ResponseResult getByNodeId(@RequestParam String nodeId) {
        return success(librarySettingService.getByNodeId(nodeId));
    }


}
